new Vue({
  el: '#app',
  data() {
    return {
      form: {
        Data: 'article_province',
        page: 1,			//页数
        limit: 10,			//每页数据条数
        Primary_Key:'',
        Primary_Key_Name:'Province_Name',
        isVague:true
      },
      formData: {},
      tableData: [],		//表格数据
      total: 1,
      dialogForm: false,
      title: '',
      multipleSelection: []
    }
  },
  mounted() {
    // this.getList()
    this.getList(this.form)
  },
  methods: {
    onSerach() {				//查询方法
      this.form.page = 1
      this.getList(this.form)
    },
    addContract() {
      console.log("跳转")
    },
    handleSizeChange(val) {
      this.form.page = 1;
      this.form.limit = val;
      this.getList(this.form)
    },
    handleCurrentChange(val) {
      this.form.page = val;
      this.getList(this.form)
    },
    getList(data) {
      let _this = this
      $.ajax({
        type: 'POST',
        data,
        url: DomainName + '/getTableInquiryAction?token='+$.cookie('token'),
        success: function (res) {
          if(res.Status=='success'){
            _this.tableData = res.tableData
            _this.total = parseInt(res.limit)
            console.log(res);
          }
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        dataType: "json"
      });
    },
    addEnterprise() {
      window.location.href = './Add.html'
    },
    editMember(Article_Province_SerialNumber) {
      sessionStorage.setItem("Article_Province_SerialNumber", Article_Province_SerialNumber)
      window.location.href = './Edit.html?Article_Province_SerialNumber=' + Article_Province_SerialNumber
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    deletMember(row) {
      this.$confirm('此操作将删除该系列, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        this.delete(row);
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    delete(row) {
      const _this = this
      row.Row_Status = '1'
      $.ajax({
        url: DomainName + '/getEditAction?token='+$.cookie('token'),
        type: 'POST',
        data: {
          Data: JSON.stringify({ Modify: { article_province: [row] }})
        },
        success: function (res) {
          _this.$message({
            type: 'success',
            message: '删除成功!'
          });
          _this.getList(_this.form);
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        }
      })
    }
  },
})